package com.zhehekeji.opsys.api.webservice.server;

import javax.jws.WebService;

import org.apache.cxf.interceptor.InInterceptors;
import org.apache.cxf.interceptor.OutInterceptors;
import org.apache.cxf.transport.common.gzip.GZIPInInterceptor;
import org.apache.cxf.transport.common.gzip.GZIPOutInterceptor;
import org.springframework.beans.factory.annotation.Autowired;

import com.zhehekeji.opsys.api.req.AddCollectReq;
import com.zhehekeji.opsys.api.req.AddPlayRecordReq;
import com.zhehekeji.opsys.api.resp.AddZoneCollectResp;
import com.zhehekeji.opsys.api.resp.AddZonePlayRecordResp;
import com.zhehekeji.opsys.api.resp.GetZoneCollectListResp;
import com.zhehekeji.opsys.api.resp.GetZoneCollectResp;
import com.zhehekeji.opsys.api.resp.GetZonePlayRecordListResp;
import com.zhehekeji.opsys.api.resp.GetZonePlayRecordResp;
import com.zhehekeji.opsys.api.resp.RemoveZoneCollectResp;
import com.zhehekeji.opsys.api.resp.RemoveZonePlayRecordResp;
import com.zhehekeji.opsys.api.service.manager.ZoneManagerService;

/**
 * @ClassName ZoneManagerWS
 * @Description TODO
 * @date 2016-7-18   下午5:26:20
 */
@InInterceptors(classes = {GZIPInInterceptor.class})
@OutInterceptors(classes = {GZIPOutInterceptor.class})
@WebService(endpointInterface = "com.zhehekeji.opsys.api.webservice.server.ZoneManager",
        name = "zoneManager", portName = "zoneManagerPort", serviceName = "zoneManagerWS")
public class ZoneManagerWS implements ZoneManager {

    @Autowired
    private ZoneManagerService zoneManagerService;
	
	/*@Override
	public AddZoneCollectResp addCollect(AddCollectReq addCollectReq) {
		
		AddZoneCollectResp resp = zoneManagerService.addCollect(addCollectReq);
		return resp;
		
	}*/

    @Override
    public AddZoneCollectResp addCollect(String zoneCode, String userID, String programCode,
                                         String programName, String categoryCode, int seriesFlag, String seriesCode, String poster) {
        AddCollectReq addCollectReq = new AddCollectReq();
        addCollectReq.setProgramCode(programCode);
        addCollectReq.setProgramName(programName);
        addCollectReq.setSeriesCode(seriesCode);
        addCollectReq.setCategoryCode(categoryCode);
        addCollectReq.setSeriesFlag(seriesFlag);
        addCollectReq.setUserID(userID);
        addCollectReq.setZoneCode(zoneCode);
        addCollectReq.setPoster(poster);
        AddZoneCollectResp resp = zoneManagerService.addCollect(addCollectReq);
        return resp;
    }

    @Override
    public RemoveZoneCollectResp removeCollect(String zoneCode, String userID, String programCode) {

        RemoveZoneCollectResp resp = zoneManagerService.removeCollect(zoneCode, userID, programCode);
        return resp;

    }

    @Override
    public GetZoneCollectResp getCollect(String zoneCode, String userID, String programCode) {

        GetZoneCollectResp resp = zoneManagerService.getCollect(zoneCode, userID, programCode);
        return resp;

    }

    @Override
    public GetZoneCollectListResp getCollectList(String zoneCode, String userID, int firstIndex, int maxResult) {

        GetZoneCollectListResp resp = zoneManagerService.getCollectList(zoneCode, userID, firstIndex, maxResult);
        return resp;

    }

    @Override
    public RemoveZoneCollectResp emptyCollect(String zoneCode, String userID) {
        RemoveZoneCollectResp resp = zoneManagerService.emptyCollect(zoneCode, userID);
        return resp;
    }

	/*@Override
	public AddZonePlayRecordResp addPlayRecord(AddPlayRecordReq addPlayRecordReq) {

		AddZonePlayRecordResp resp = zoneManagerService.addPlayRecord(addPlayRecordReq);
		return resp;

	}*/

    @Override
    public AddZonePlayRecordResp addPlayRecord(String zoneCode, String userID, String programCode,
                                               String programName, String categoryCode, int playTime, int seriesFlag, int setNo, String seriesCode,
                                               String poster, int totalPlayTime) {
        AddPlayRecordReq addPlayRecordReq = new AddPlayRecordReq();
        addPlayRecordReq.setPlayTime(playTime);
        addPlayRecordReq.setProgramCode(programCode);
        addPlayRecordReq.setProgramName(programName);
        addPlayRecordReq.setSeriesCode(seriesCode);
        addPlayRecordReq.setCategoryCode(categoryCode);
        addPlayRecordReq.setSeriesFlag(seriesFlag);
        addPlayRecordReq.setSetNo(setNo);
        addPlayRecordReq.setUserID(userID);
        addPlayRecordReq.setZoneCode(zoneCode);
        addPlayRecordReq.setPoster(poster);
        addPlayRecordReq.setTotalPlayTime(totalPlayTime);
        AddZonePlayRecordResp resp = zoneManagerService.addPlayRecord(addPlayRecordReq);
        return resp;
    }

    @Override
    public RemoveZonePlayRecordResp removePlayRecord(String zoneCode, String userID, String programCode) {

        RemoveZonePlayRecordResp resp = zoneManagerService.removePlayRecord(zoneCode, userID, programCode);
        return resp;

    }

    @Override
    public RemoveZonePlayRecordResp emptyPlayRecord(String zoneCode, String userID) {
        RemoveZonePlayRecordResp resp = zoneManagerService.emptyPlayRecord(zoneCode, userID);
        return resp;
    }

    @Override
    public GetZonePlayRecordResp getPlayRecord(String zoneCode, String userID, String programCode) {

        GetZonePlayRecordResp resp = zoneManagerService.getPlayRecord(zoneCode, userID, programCode);
        return resp;

    }

    @Override
    public GetZonePlayRecordListResp getPlayRecordList(String zoneCode, String userID, int firstIndex, int maxResult) {

        GetZonePlayRecordListResp resp = zoneManagerService.getPlayRecordList(zoneCode, userID, firstIndex, maxResult);
        return resp;
    }

}

